<div id='panel'>
<table width="100%" border="0">
  <tr>
    <td class="contentHeader"><h2>Categories with in <?php echo getcategoryName($_GET['subCat']);?></h2></td>
  </tr>
<tr><td class="content" height="500" valign="top">
<?php
if(isset($_GET['subCat']) && !empty($_GET['subCat']))
{
$sqlSelSubCat="SELECT category_id,category_name,parent_id from tbl_category where parent_id=".$_GET['subCat'];
$rstSelSubCat=mysql_query($sqlSelSubCat);
$numSelSubCat=mysql_num_rows($rstSelSubCat);
if($numSelSubCat>0)
	{
		while($rowSelSubCat=@mysql_fetch_array($rstSelSubCat)) 
		{
		  echo "<a href='index.php?cat=".$rowSelSubCat["category_id"]."'>".$rowSelSubCat["category_name"]."</a><br>";
		}
	}
else
		{
		$sqlSelSubCat="SELECT category_id,category_name,parent_id from tbl_category where category_id=".$_GET['subCat'];
		$rstSelSubCat=mysql_query($sqlSelSubCat);
		$data=mysql_fetch_object($rstSelSubCat);
		if($data->parent_id=='1'){
		  echo "<a href='index.php?cat=".$_GET['subCat']."'>".getcategoryName($_GET['subCat'])."</a><br>";
		  }else{
		  echo "<a href='index.php?srchPost=".$data->parent_id."&category=".$_GET['subCat']."&catId=".$data->parent_id."'>".getcategoryName($_GET['subCat'])."</a><br>";
		  }
		}
}
?>
</td>
</tr>
</table>
</div>
